﻿using System.Collections.Generic;
using Nim2D.Components;

namespace Nim2D.Managers {

	public static class ComponentManager {

		public enum ComponentType {

			Position,
			Appearance

		}

		public static readonly Dictionary<ComponentType, Dictionary<int, Component>> ComponentDictionaries;

		static ComponentManager() {
			ComponentDictionaries = new Dictionary<ComponentType, Dictionary<int, Component>> {
				{ComponentType.Position, new Dictionary<int, Component>()},
				{ComponentType.Appearance, new Dictionary<int, Component>()}
			};
		}

		// TODO: What about parallel arrays instead of Dictionaries?

		public static void ClearDictionaries() {
			foreach (var componentDictionary in ComponentDictionaries) {
				ComponentDictionaries[componentDictionary.Key].Clear();
			}
			ComponentDictionaries.Clear();
		}

	}

}